#!/bin/bash

for ((i=7;i<14;i++))
do

	createday=`date -d $(($i+1))' day' '+%Y-%m-%d'`
	createname='p'`date -d $i' day' '+%y%m%d'`
	createquery="ALTER TABLE data_news ADD PARTITION (PARTITION $createname VALUES LESS THAN (TO_DAYS('$createday')))"
	#createquery="ALTER TABLE data_news DROP PARTITION $createname"
	echo $createquery
	mysql -ugamevil -pvlwlrpaqlf pz_user -e "$createquery"
done
